﻿using LogisticsTrackingWebApi_V2.Models;
using LogisticsTrackingWebApi_V2.Services;

namespace LogisticsTrackingWebApi_V2.ServicesImpl
{
    /// <summary>
    /// 顺丰物流查询实现
    /// </summary>
    public class SFExpressProvider : ILogisticsProvider
    {
        public string CompanyCode => "SF";
        public string CompanyName => "顺丰速运";

        public async Task<LogisticsInfo> QueryLogisticsAsync(string trackingNumber)
        {
            // 实际项目中这里会调用顺丰的API
            await Task.Delay(100); // 模拟API调用延迟

            return new LogisticsInfo
            {
                TrackingNumber = trackingNumber,
                CompanyCode = CompanyCode,
                CompanyName = CompanyName,
                Status = LogisticsStatus.InTransit,
                LastUpdated = DateTime.Now.AddHours(-2),
                TrackingRecords = new List<TrackingRecord>
            {
                new TrackingRecord { Time = DateTime.Now.AddHours(-2), Location = "上海市", Description = "快件已发出" },
                new TrackingRecord { Time = DateTime.Now.AddHours(-5), Location = "上海市", Description = "快件已揽收" },
                new TrackingRecord { Time = DateTime.Now.AddHours(-6), Location = "", Description = "订单已创建" }
            }
            };
        }
    }

}
